<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="f" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">
		<script type="text/javascript" src="<%=path%>/jslib/jquery-1.9.1.js"></script>
		<script type="text/javascript" src="<%=path%>/jslib/jquery.form.js"></script>
		<script type="text/javascript" src="<%=path%>/jslib/jquery.validate.min.js"></script>
    	<script type="text/javascript" src="<%=request.getContextPath() %>/jslib/lhgdialog/lhgcore.lhgdialog.min.js?skin=mac"></script>
		<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/css/layout.css" />
		<script type="text/javascript">
		$(document).ready(function() {
					 
					var options1 = {
							url : "system/tips!editTip.action",
							beforeSubmit: function() {
					    		return $('#form2').validate().form();
					    	},
							type : "POST",
							dataType : "text",
							success : function(msg) {
								 alert(msg);
							}
						};
					 
					$('#edit').click(function(){
						$('#form2').ajaxSubmit(options1);
						return false;
					});
					$("#form2").validate({
						onkeyup :false,onclick:false,
							rules: {
								tipContent: {
								      required: true,
								      maxlength:2000
									} 
								},
							messages: {
								tipContent: {
								      required: "提示内容不能为空",
								      maxlength: "内容过长"
								}  
							},
							/* 重写错误显示消息方法,以alert方式弹出错误消息 */  
						   showErrors : function(errorMap, errorList) {
						    var msg = "";  
						    $.each(errorList, function(i, v) {  
						     msg = (v.message + "\r\n");  
						    
						    if (msg != ""){
						     alert(msg);
						     return false;  
						     }
						     });  
						   onfocusout=false; 
						   }
					}); 
				}); 
	 
</script>
	</head>

	<body>
	<center>
	<div class="table-div">
		<form id="form2" method="post" >
		<input type="hidden" id="id" name="id" value="${tip.id }">
			<table width="100%" border="0" cellspacing="1" cellpadding="10" class="formTableNew">
			<tr>
					<td>
					提示内容：
					</td>
					<td>
					<input type="text" value="${tip.tipContent }" id="tipContent" name="tipContent">
					</td>
				</tr>
				<tr>
					<td>
					SQL：
					</td>
					<td>
					<textarea rows="10" cols="50" id="tipSql" name="tipSql">${tip.tipSql }</textarea><br>
					用户ID：#USER_ID#;登陆名：#LOGIN_NAME#;登陆部门：#USER_DEPT#;所属角色：#USER_ROLE#(需用in);日期：#YYYY-MM-DD#
					</td>
				</tr>
				<tr>
					<td height="25">
						URL：
					</td>
					<td>
					<input type="text" value="${tip.url }" id="url" name="url" ><br>
					参数信息：#PARAM#,值对应上方SQL查询结果集。
					</td>
				</tr> 
				<tr>
					<td height="25">
						提醒类型：
					</td>
					<td>
						<select id="type" name="type">
							<option value="1" <c:if test="${tip.type==1 }">selected="selected"</c:if>>文本形式</option>
							<option value="2" <c:if test="${tip.type==2 }">selected="selected"</c:if>>超链接形式</option>
						</select>
					</td>
				</tr> 
				<tr>
					<td colspan="2">
					<input type="button" id="edit" name="edit" value="保存" class="form_bt_orange">
					</td>
				</tr>
			</table>
		</form>
		</div>
        </center>
	</body> 
</html>
